package com.ppg.basic.collection;

import com.google.common.collect.Lists;

import java.util.List;

public class ListTest {

    public static void main(String[] args) {

        int size = 1000000;

        List<Integer> list = Lists.newLinkedList();
        long start1 = System.currentTimeMillis();
        for (int i = 0;i < 1000000; i++){
            list.add(i);
        }

        System.out.println("newLinkedList 执行时间： " + (System.currentTimeMillis() - start1));

        long start2 = System.currentTimeMillis();
        List<Integer> list2 = Lists.newArrayList(size);
        for (int i = 0;i < 1000000; i++){
            list2.add(i);
        }
        System.out.println("ArrayList 执行时间： " + (System.currentTimeMillis() - start2));
    }
}
